#!/bin/sh

PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

case $1 in
	start)
	nginx && echo 'Nginx started.'
	;;
	stop)
	nginx -s quit && echo 'Nginx gracefully stopped.'
	;;
	restart)
	nginx -s stop && nginx && echo 'Nginx restarted.'
	;;
	reload)
	nginx -s reload && echo 'Nginx configuration reload.'
	;;
	reopen)
	nginx -s reopen && echo 'Nginx log files reopened.'
	;;
	test)
	nginx -t
	;;
	*)
	echo "Usage: $0 {start|stop|restart|reload|reopen|test}"
	;;
esac
